package com.ethank.web.controller.tool;

import com.ethank.common.core.domain.AjaxResult;
import com.ethank.system.service.OcrService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

/**
 * @author Administrator
 * @date 2024/2/22
 * @Description 票据识别
 */
@RequestMapping("/ocr")
@RestController
public class OcrController {

    @Resource
    private OcrService ocrService;


    /**
     * @Description: 上传票据
     * @Param: [file]
     * @return: com.ethank.common.core.domain.AjaxResult
     * @Date: 2024-02-23
     */
    @PostMapping("/billUpload")

    public AjaxResult billUpload(MultipartFile file, @RequestParam(name = "type",required = false,defaultValue = "1") Integer type) throws Exception {
        return ocrService.billUpload(file,type);
    }

    /**
     * @Description: 发票核验
     * @Param: [invoiceNo, invoiceDate]
     * @return: com.ethank.common.core.domain.AjaxResult
     * @Author: tf
     * @Date: 2024-02-26
     */
    @PostMapping("/verifyInvoice")
    public AjaxResult verifyVATInvoice(String invoiceNo, String invoiceDate) {
        return ocrService.verifyInvoice(invoiceNo, invoiceDate);
    }
}
